/*
 * launcher_robot14.cpp
 *
 *  Created on: Dec 19, 2013
 *      Author: m
 */

#include "ProcessAux.h"
#include "Cinta13A.h"
#include "Cinta13B.h"
#include "Cinta15.h"
#include "Robot11AProductor.h"
#include "Robot11BProductor.h"
#include "Robot14Consumidor.h"
#include "Robot14Productor.h"
#include "Robot16Consumidor.h"
#include "DSEMManager.h"
#include "../middleware/CommunicationAdpt.h"
#include "../middleware/CommunicationDespacho.h"
#include "../middleware/CommunicationRobot16.h"
#include "../channel_common/ChannelInterface.h"
#include "../common/Argv.h"
#include "../IPC/ProcessAux.h"



int main ( int argc, char* argv[] )
{
	std::string hostName = "robot14_pc";

	Argv args;
	args.pushArg(hostName);
	channel::ChannelInterface::create(hostName);

	ProcessAux::launchProcess2("./out/channel_out_agente",1,args);
	ProcessAux::launchProcess2("./out/channel_in_agente",1,args);

	middleware::CommunicationRobot16::create(middleware::CommunicationRobot16::SIDE_ROBOT_14,hostName);

    // Lanzar los semaforos distribuidos especificos del robot14
    DSEMManager::createSignaler( Cinta13A::s_ipcBaseFile, Cinta13A::s_semProductorKey1, "cinta13aprod" );
    DSEMManager::createWaiter( Cinta13A::s_ipcBaseFile, Cinta13A::s_semConsumidorKey2, "cinta13acons" );
    DSEMManager::createSignaler( Cinta13B::s_ipcBaseFile, Cinta13B::s_semProductorKey1, "cinta13bprod" );
    DSEMManager::createWaiter( Cinta13B::s_ipcBaseFile, Cinta13B::s_semConsumidorKey2, "cinta13bcons" );
    DSEMManager::createWaiter( Cinta15::s_ipcBaseFile, Cinta15::s_semProductorKey2, "cinta15prod" );
    DSEMManager::createSignaler( Cinta15::s_ipcBaseFile, Cinta15::s_semConsumidorKey1, "cinta15cons" );
    DSEMManager::createSignaler( Robot11AProductor::s_ipcBaseFile, Robot11AProductor::s_semaphoreKey1, "r11aprod" );
    DSEMManager::createSignaler( Robot11BProductor::s_ipcBaseFile, Robot11BProductor::s_semaphoreKey1, "r11bprod" );
    DSEMManager::createWaiter( Robot14Productor::s_ipcBaseFile, Robot14Productor::s_semaphoreKey2, "r14prod" );
    DSEMManager::createSignaler( Robot16Consumidor::s_ipcBaseFile, Robot16Consumidor::s_semaphoreKey1, "r16cons" );
    DSEMManager::createWaiter( Robot14Consumidor::s_ipcBaseFile, Robot14Consumidor::s_semaphoreKey2, "r14cons" );

//    ProcessAux::launchProcess( "./controlR14" );

    return 0;
}
